<template>
  <!-- 轮播图 -->
  <div class="box">
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in images" :key="item.id">
        <img :src="item.img" alt="" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script setup>
import { getBannerList } from '@/api/home'
import { ref, onMounted } from 'vue'
const images = ref([])
onMounted(async () => {
  const res = await getBannerList()
  images.value = res.data.data
  // console.log(res.data.data)
})
</script>

<style lang="less" scoped>
.box {
  margin-top: 50px;
}
.my-swipe {
  width: 90%;
  margin: 0 auto;
  img {
    width: 100%;
  }
}
</style>
